package logic

import (
	"context"
	"vip_srv/model/mysql"

	"vip_srv/internal/svc"
	"vip_srv/vip"

	"github.com/zeromicro/go-zero/core/logx"
)

type MemberLogic struct {
	ctx    context.Context
	svcCtx *svc.ServiceContext
	logx.Logger
}

func NewMemberLogic(ctx context.Context, svcCtx *svc.ServiceContext) *MemberLogic {
	return &MemberLogic{
		ctx:    ctx,
		svcCtx: svcCtx,
		Logger: logx.WithContext(ctx),
	}
}

func (l *MemberLogic) Member(in *vip.MemberRequest) (*vip.MemberResponse, error) {
	// todo: add your logic here and delete this line

	viper := mysql.VipUser{
		Title:   in.Title,
		Price:   in.Price,
		Cover:   in.Cover,
		Status:  in.Status,
		ShopNum: in.ShopNum,
	}

	err := viper.AddViper()
	if err != nil {
		return nil, err
	}

	return &vip.MemberResponse{}, nil
}
